#version 460 core
out vec4 FragColor;
in vec3 ourNor;
in vec3 FragPos;
in vec3 Color;
uniform vec3 viewPos;
void main()
{
	float diffs = 0.8;
	vec3 lightDir1 = vec3(0, 0, 1);
	float diff1 = max(dot(ourNor, lightDir1), 0.0);
	vec3 lightColor1 = vec3(1.0f, 1.0f, 1.0f);
	vec3 diffuse1 = diff1 * diffs * lightColor1;

	vec3 lightDir2 = vec3(1, 1, 0);
	float diff2 = max(dot(ourNor, lightDir2), 0.0);
	vec3 lightColor2 = vec3(0.0f, 0.2f, 0.2f);
	vec3 diffuse2 = diff2 * diffs * lightColor2;

	float specularStrength = 0.5;
	float specs = 0.4;
	vec3 viewDir = normalize(viewPos - FragPos);

	vec3 reflectDir1 = reflect(-lightDir1, ourNor);
	float spec1 = pow(max(dot(viewDir, reflectDir1), 0.0), 32);
	vec3 specular1 = spec1 * specs * lightColor1;

	vec3 reflectDir2 = reflect(-lightDir2, ourNor);
	float spec2 = pow(max(dot(viewDir, reflectDir2), 0.0), 32);
	vec3 specular2 = spec2 * specs * lightColor2;

	FragColor = vec4((diffuse1 + diffuse2  + specular1 + specular2 + 0.2) * Color, 1.0);
}